package com.qingsong.dto;

import com.qingsong.constant.RE;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/** @author qingsong */
@Schema(name = "优惠卷添加DTO")
@Data
public class CouponsInsertDTO implements Serializable, RE {
    @NotEmpty(message = "兑换码不能为空")
    @Size(min = 1, max = 42, message = "标题长度必须在1~42之间")
    @Schema(description = "兑换码")
    private String code;

    @NotEmpty(message = "标题不能为空")
    @Size(min = 1, max = 42, message = "标题长度必须在1~42之间")
    @Schema(description = "标题")
    private String title;

    @NotNull(message = "优惠金额不能为空")
    @Schema(description = "优惠金额")
    private Double cpPrice;

    @NotEmpty(message = "描述不能为空")
    @Pattern(regexp = INFO_RE, message = INFO_RE_MSG)
    @Schema(description = "信息")
    private String info;

    @Future(message = "生效时间必须是一个未来的时间")
    @NotNull(message = "生效时间不能为空")
    @Schema(description = "生效时间")
    private LocalDateTime startTime;

    @NotNull(message = "失效时间不能为空")
    @Schema(description = "失效时间")
    private LocalDateTime endTime;
}
